<?php
/**
 * class LRView
 *  
 */
class LRView {

    
    public static function editProfile($data) {
        return'
<div class="span6">
    <form class="form-horizontal" method="post">
                <fieldset>
                    <div class="control-group">
                        <label class="control-label">ФИО:</label><div class="controls"><input type="text" name="realname" class="span3" value="'.$data['realname'].'"></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">email:</label><div class="controls"><input type="text" name="email" class="span3" value="'.$data['mail'].'"></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Дата рождения:</label><div class="controls"><input type="text" name="bday" class="span3" value="'.$data['bday'].'"></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Телефон:</label><div class="controls"><input type="text" name="phone" class="span3" value="'.$data['phone'].'"></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Старый пароль:</label><div class="controls"><input type="password" name="old_password" class="span3" value=""></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Новый пароль:</label><div class="controls"><input type="password" name="new_password" class="span3" value=""></div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Повотрите новый пароль:</label><div class="controls"><input type="password" name="new_password_repeat" class="span3" value=""></div>
                    </div>
                    <div class="form-actions">
                        <input name="edit_profile" type="submit" value="Сохранить изменения" class="btn btn-primary"> 
                    </div>
                </fieldset>
            </form>
</div>
';
    }




    public static function getProfile($data, $isOwner) {


        $out = '';
        
     $out.='<div id="left_profile" class="span3">
               <div id="photo" class="span2">
                        <a href="'.$data['photo_big'].'" class="thumbnail">
                            <img src="'.$data['photo_medium'].'" alt="Аватар">
                        </a>
               </div>
               <div id="create_company" class="span2">
               ';
        if (!$data['hascompany'] && $isOwner)
            $out.='<a href="' . HTTP_SERVER . 'Company/create" class="btn btn-danger create_company_btn">Создать компанию</a>';
        else {
            if ($data['hascompany']) {
                $out.='Владелец компании <a href="' . HTTP_SERVER . 'Company/profile/'.$data['company']['company_id'].'"><b>&laquo;' . $data['company']['name'] . '&raquo;</b></a>';
            } else {
                $out.='Нет компании';
            }
        }
        $out.='</div></div><div id="profile_information" class="span4">';
                  

if($isOwner)
$out.='<div class="edit_button"><a href="'.HTTP_SERVER.'LR/profile/edit/'.$data['user_id'].'" class="btn btn-primary">ред.</a></div>';

$out.='
        <table class="span3 table table-condensed profile_table">
            <tr><td><label><strong>Логин:</strong></label></td><td>'.$data['user_login'].'</td></tr>
            <tr><td><label><strong>ФИО:</strong></label></td><td>'.$data['realname'].'</td></tr>
            <tr><td><label><strong>e-mail:</strong></label></td><td>'.$data['mail'].'</td></tr>
            <tr><td><label><strong>Дата рождения:</strong></label></td><td>'.$data['bday'].'</td></tr>
            <tr><td><label><strong>Телефон:</strong></label></td><td>'.$data['phone'].'</td></tr>
        </table>


        </div>';
return $out;
    }
    
    
    
    public static function getLoginFormstd() {
        return '
            <div>
            <form method="POST" action="'.HTTP_SERVER.'LR/login/std'.'">
            <label>Логин</label><span class="lr-span"><input name="login" type="text" class="span2"></span>
            <label>Пароль</label><span class="lr-span"><input name="password" type="password" class="span2"></span>
            <input name="submit" type="submit" value="Войти" class="btn">
            <a href="'.HTTP_SERVER.'LR/registration" class="btn btn-primary">Регистрация</a>
            </form>
            </div>';
    }
      
    public static function getRegistrationForm() {
       
    return '<div class="span6">
            <form method="POST" action="'.HTTP_SERVER.'LR/registration" class="form-horizontal">
                <fieldset>
                    <div class="control-group"><label class="control-label">Логин</label><div class="controls"><input name="login" type="text" class="span3"></div></div>
                    <div class="control-group"><label class="control-label">Пароль</label><div class="controls"><input name="password" type="password" class="span3"></div></div>
                    <div class="form-actions"><input name="submit" type="submit" value="Зарегистрироваться" class="btn btn-primary"></div>
                </fieldset>
            </form>
        </div>';

    }
    public static function getLoginFormVK() {
        return'
            <div>
            <script src="http://vkontakte.ru/js/api/openapi.js" type="text/javascript"></script>
            <div id="login_button" onclick="VK.Auth.login(authInfo);"></div>
            <script type="text/javascript">
              VK.init({
                 apiId: '.VK_APP_ID.'
             });
             function authInfo(response) {
                     window.location = "'.HTTP_SERVER.'LR/login/VK"
             }
             VK.UI.button("login_button");
            </script></div>';
    }
    
}
?>
